package rad.framework.mda.generator.template.main.webapp;

import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.*;
import java.util.*;
import rad.framework.mda.generator.util.*;

public class TreeNodes
{
  protected static String nl;
  public static synchronized TreeNodes create(String lineSeparator)
  {
    nl = lineSeparator;
    TreeNodes result = new TreeNodes();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"" + NL + "\txmlns:ui=\"http://java.sun.com/jsf/facelets\"" + NL + "\txmlns:h=\"http://java.sun.com/jsf/html\"" + NL + "\txmlns:f=\"http://java.sun.com/jsf/core\"" + NL + "\txmlns:tt=\"https://code.google.com/p/rad-framework\">" + NL + "\t";
  protected final String TEXT_2 = NL + "\t<tt:treeNode type=\"";
  protected final String TEXT_3 = "\" />";
  protected final String TEXT_4 = "     " + NL + "</ui:composition>";
  protected final String TEXT_5 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    

    Model uml2Model = (Model) argument;
    stringBuffer.append(TEXT_1);
    for (Iterator<Class> i=ClassHelper.getClasses(uml2Model).iterator(); i.hasNext();) { Class c = i.next();
    stringBuffer.append(TEXT_2);
    stringBuffer.append(NameHelper.getCapName(c));
    stringBuffer.append(TEXT_3);
    }
    stringBuffer.append(TEXT_4);
    stringBuffer.append(TEXT_5);
    return stringBuffer.toString();
  }
}
